package com.zl.learning.thread.thread_local;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;

public class Main {
    public static void main(String[] args) {
        try {
            URL[] urls = {new URL("file:lib/ThreadLocal.jar")};
            URLClassLoader classLoader = new URLClassLoader(urls);
            Class c = classLoader.loadClass("ChildClassLoad");
            Method m = c.getMethod("sayHello");
            m.invoke(c.newInstance());
        } catch (MalformedURLException e) {
            e.printStackTrace();
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        } catch (NoSuchMethodException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        } catch (InvocationTargetException e) {
            e.printStackTrace();
        } catch (InstantiationException e) {
            e.printStackTrace();
        }

    }
}
